﻿using System;
using System.Drawing;
using System.Windows.Forms;
using CamPlug.Api;

namespace CamPlug.CurrentTime.Plugin
{
	public class CurrentTimePlugin : IPlugin
	{
		public const string Name = "Current time";

		string IPlugin.Name { get { return Name; } }

		public byte[] SaveSettings()
		{
			return new byte[0];
		}

		public void LoadSettings(byte[] settings)
		{
		}

		public void UpdateBitmap(Bitmap bitmap)
		{
			Font font = new Font("Arial", 32);
			using (var canvas = Graphics.FromImage(bitmap))
			{
				string displayText = DateTime.Now.ToString();
				var textSize = canvas.MeasureString(displayText, font);
				var displayPoint = new PointF(bitmap.Width - textSize.Width, bitmap.Height - textSize.Height);
				canvas.DrawString(displayText, font, Brushes.White, displayPoint);
			}
		}

		public void ShowPropertiesForm()
		{
		}

		public void ShuttingDown()
		{

		}
	}
}
